package org.pictual.service;

import org.apache.log4j.Logger;
import org.pictual.business.dao.DAOFactory;
import org.pictual.business.dao.MySQLDAOFactory;
import org.pictual.business.dao.exceptions.DAOException;


public class SequenceGeneratorDelegateImpl implements SequenceGeneratorDelegate{

	private static SequenceGeneratorDelegateImpl _instance = null;
	protected static Logger log= Logger.getLogger(SequenceGeneratorDelegateImpl.class);
	
	private SequenceGeneratorDelegateImpl(){}

	public static SequenceGeneratorDelegateImpl getInstance(){
		if(_instance==null){
    		_instance = new SequenceGeneratorDelegateImpl();
    	}
        return _instance;
	}
	
	public String generateId(String id) throws DAOException {
		String generateId = DAOFactory.getDAOFactory(DAOFactory.MYSQL).getSequenceGeneratorDAO().generateId(id);
	
//		MySQLDAOFactory.closeConnection();
		
		return generateId;
	}

}
